package com.mycode.command15.resolve2;

// 模拟 计算机 撤销操作 提供可撤销的方法
public class CalculatorForm {

    private AbstractCommand command;

    public void setCommand(AbstractCommand command) {
        this.command = command;
    }

    public void compute(int value) {
        int execute = command.execute(value);
        System.out.println("执行运算，运算结果：" + execute);
    }

    public void undo() {
        int i = command.undo();
        System.out.println("执行撤销，运算结果为：" + i);
    }
}
